﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DockSample;

namespace DockSample.CodeGenerator
{
    public enum FieldType
    {
        String,
        Integer,
        Float,
        Long,
        Date
    }

    class JavaEntityFieldInfo
    {
        public string fieldType;
        public string fieldName;

        private  string[] WriteOfInteger = {"int","INT","Int","Integer","INTEGER","integer" };
        private  string[] WriteOfString = new string[] { "String", "string", "STRING" };
        private  string[] WriteOfFloat =new string[] { "Float", "float", "FLOAT" };
        private  string[] WriteOfLong = new string[] { "Long", "long", "LONG" };
        private  string[] WriteOfDate = new string[] { "Date", "date", "DATE", "datetime", "Datetime", "time" };

        private JavaEntityFieldInfo() { }

        public JavaEntityFieldInfo(Attribute attr)
        {
            this.fieldName = attr.AttributeName;
            String attrFieldType = attr.AttributeType;
            
            if (StringUtil.ValidateEquals(attrFieldType,WriteOfInteger))
            {
                 this.fieldType= FieldType.Integer.ToString();
            }
            else if (StringUtil.ValidateEquals(attrFieldType, WriteOfString))
            {
                this.fieldType = FieldType.String.ToString();
            }
            else if (StringUtil.ValidateEquals(attrFieldType, WriteOfFloat))
            {
                this.fieldType = FieldType.Float.ToString();
            }
            else if (StringUtil.ValidateEquals(attrFieldType, WriteOfLong))
            {
                this.fieldType = FieldType.Long.ToString();
            }
            else if (StringUtil.ValidateEquals(attrFieldType, WriteOfDate))
            {
                this.fieldType = FieldType.Date.ToString();
            }
            
        }
       

        
    }
}
